# -*- coding: UTF-8 -*-
# @Project ：luffycity 
# @File    ：在继承中的读写.py
# @Author  ：于金龙
# @IDE     ：PyCharm 
# @Date    ：2024/4/10 9:35


class Base(object):
    country = "中国"


class Person(Base):
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def show(self):
        message = "{}-{}-{}".format(Person.country, self.name, self.age)
        print(message)


print(Base.country)  # 中国

print(Person.country)  # 中国
P1 = Person("于金龙", 22)
P1.show()  # 中国-于金龙-22

# 写
Person.country = 'china111'
# 更改无效果
P1.country = 'china'
P1.show()

var = P1.country
print(var)
